package weixin

import (
	// "github.com/martini-contrib/render"
	// "log"
	// "github.com/go-martini/martini"
	// "fmt"
	"encoding/xml"
	"io/ioutil"
	"net/http"
	// "server/conf"
	"server/framework/weixin/msg"
	"server/lib/Imartini"
	"time"
)

func pvalidate(res http.ResponseWriter, req *http.Request, log *Imartini.Mlog, g Imartini.G) string {
	body, _ := ioutil.ReadAll(req.Body)
	log.Other("weixin.", g["route"].(string), time.Since(g["starttime"].(time.Time)), body)

	var v msg.WeixinXML
	xml.Unmarshal(body, &v)

	return msg.SendTXT(v, v.Content)
}
